import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/auth/captcha_get_entity.dart';

CaptchaGetEntity $CaptchaGetEntityFromJson(Map<String, dynamic> json) {
  final CaptchaGetEntity captchaGetEntity = CaptchaGetEntity();
  final String? repCode = jsonConvert.convert<String>(json['repCode']);
  if (repCode != null) {
    captchaGetEntity.repCode = repCode;
  }
  final String? repMsg = jsonConvert.convert<String>(json['repMsg']);
  if (repMsg != null) {
    captchaGetEntity.repMsg = repMsg;
  }
  final CaptchaGetRepData? repData = jsonConvert.convert<CaptchaGetRepData>(json['repData']);
  if (repData != null) {
    captchaGetEntity.repData = repData;
  }
  final bool? success = jsonConvert.convert<bool>(json['success']);
  if (success != null) {
    captchaGetEntity.success = success;
  }
  return captchaGetEntity;
}

Map<String, dynamic> $CaptchaGetEntityToJson(CaptchaGetEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['repCode'] = entity.repCode;
  data['repMsg'] = entity.repMsg;
  data['repData'] = entity.repData.toJson();
  data['success'] = entity.success;
  return data;
}

extension CaptchaGetEntityExtension on CaptchaGetEntity {
  CaptchaGetEntity copyWith({
    String? repCode,
    String? repMsg,
    CaptchaGetRepData? repData,
    bool? success,
  }) {
    return CaptchaGetEntity()
      ..repCode = repCode ?? this.repCode
      ..repMsg = repMsg ?? this.repMsg
      ..repData = repData ?? this.repData
      ..success = success ?? this.success;
  }
}

CaptchaGetRepData $CaptchaGetRepDataFromJson(Map<String, dynamic> json) {
  final CaptchaGetRepData captchaGetRepData = CaptchaGetRepData();
  final String? secretKey = jsonConvert.convert<String>(json['secretKey']);
  if (secretKey != null) {
    captchaGetRepData.secretKey = secretKey;
  }
  final String? originalImageBase64 = jsonConvert.convert<String>(json['originalImageBase64']);
  if (originalImageBase64 != null) {
    captchaGetRepData.originalImageBase64 = originalImageBase64;
  }
  final String? jigsawImageBase64 = jsonConvert.convert<String>(json['jigsawImageBase64']);
  if (jigsawImageBase64 != null) {
    captchaGetRepData.jigsawImageBase64 = jigsawImageBase64;
  }
  final String? token = jsonConvert.convert<String>(json['token']);
  if (token != null) {
    captchaGetRepData.token = token;
  }
  return captchaGetRepData;
}

Map<String, dynamic> $CaptchaGetRepDataToJson(CaptchaGetRepData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['secretKey'] = entity.secretKey;
  data['originalImageBase64'] = entity.originalImageBase64;
  data['jigsawImageBase64'] = entity.jigsawImageBase64;
  data['token'] = entity.token;
  return data;
}

extension CaptchaGetRepDataExtension on CaptchaGetRepData {
  CaptchaGetRepData copyWith({
    String? secretKey,
    String? originalImageBase64,
    String? jigsawImageBase64,
    String? token,
  }) {
    return CaptchaGetRepData()
      ..secretKey = secretKey ?? this.secretKey
      ..originalImageBase64 = originalImageBase64 ?? this.originalImageBase64
      ..jigsawImageBase64 = jigsawImageBase64 ?? this.jigsawImageBase64
      ..token = token ?? this.token;
  }
}